package com.hmsg.health.service;



import lombok.extern.slf4j.Slf4j;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.convert.RemoveIndexedData;
import org.springframework.stereotype.Service;

import org.springframework.transaction.annotation.Transactional;

import com.hmsg.health.bean.domain.BannerDo;
import com.hmsg.health.bean.domain.UserDo;
import com.hmsg.health.bean.domain.UserTaskDo;
import com.hmsg.health.dao.BannerDao;
import com.hmsg.health.dao.UserDao;
import com.hmsg.health.dao.UserTaskDao;

@Slf4j
@Service
public class CommonService {
   
    @Autowired
    private UserDao userDao;
    @Autowired
    private UserTaskDao userTaskDao;
    @Autowired
    private BannerDao bannerDao;
    public BannerDo findOneBanner(Integer id){
    	BannerDo demoDo = bannerDao.findOne(id);
    	
        return demoDo == null ? null : demoDo;
    }

    @Transactional
    public Integer saveBanner(BannerDo banner){
    	Integer res = bannerDao.save(banner);
        return res;
    }
    
    public Integer updateBanner(BannerDo banner){
    	Integer res = bannerDao.update(banner);
        return res;
    }
    
    public List<BannerDo> selectBanner(BannerDo banner){
    	List<BannerDo> res = bannerDao.select(banner);
        return res;
    }
    
    public int deleteBanner(Integer userId){
    	return bannerDao.delete(userId);
    	
    }
    
   
}